package com.encyclopedia.controller;

import com.encyclopedia.entity.Crop;
import com.encyclopedia.service.CropService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/plant/crop")
public class CropController {
    @Autowired
    private CropService cropService;

    @RequestMapping("/cropAll")
    public List<Crop> cropAll() {
        List<Crop> cropAll = null;
        try {
            cropAll = cropService.getCropAll();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return cropAll;
    }
}
